package hy;

import org.junit.Test;
import sun.misc.BASE64Encoder;

import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;

public class TestApp {
    @Test
    public void test1() throws NoSuchAlgorithmException {
        String pass="丈夫在世当有为";
        MessageDigest md=MessageDigest.getInstance("MD5");
        byte[]arr=md.digest(pass.getBytes());
        BASE64Encoder ec=new BASE64Encoder();
        System.out.println("加密后字符串："+ec.encode(arr));

    }
}
